package com.shenmazong.controller;


import com.shenmazong.entity.TbArticle;
import com.shenmazong.service.TbArticleService;
import com.shenmazong.utils.ResultResponse;
import com.shenmazong.vo.ListParamVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 技术文章表   ——> John 前端控制器
 * </p>
 *
 * @author 还怕大雨吗
 * @since 2021-09-18
 */
@RestController
@RequestMapping("/tbArticle")
@CrossOrigin
public class TbArticleController {

    @Resource
    private TbArticleService tbArticleService;

    
    /***
     * @description 查询所有技术文章
     * @params [listParamVo]
     * @return com.shenmazong.utils.ResultResponse
     * @author -还怕大雨吗
     * @date 2021/9/18 10:39
     */
    @PostMapping("/selectArticle")
    public ResultResponse selectArticle(@RequestBody ListParamVo listParamVo){
        return tbArticleService.selectArticle(listParamVo);
    }

    /***
     * @description 删除自己的技术文章
     * @params [listParamVo]
     * @return com.shenmazong.utils.ResultResponse
     * @author -还怕大雨吗
     * @date 2021/9/18 10:39
     */
    @PostMapping("/deleteArticle")
    public ResultResponse deleteArticle(Long articID){
        return tbArticleService.deleteArticle(articID);
    }

    /***
     * @description 发布文章
     * @params [listParamVo]
     * @return com.shenmazong.utils.ResultResponse
     * @author -还怕大雨吗
     * @date 2021/9/18 11:23
     */
    @PostMapping("/insertArticle")
    public ResultResponse insertArticle(@RequestBody TbArticle tbArticle){
        return tbArticleService.insertArticle(tbArticle);
    }


    /***
     * @description 修改文章
     * @params [listParamVo]
     * @return com.shenmazong.utils.ResultResponse
     * @author -还怕大雨吗
     * @date 2021/9/18 11:28
     */
    @PostMapping("/updateArticle")
    public ResultResponse updateArticle(@RequestBody TbArticle tbArticle){
        return tbArticleService.updateArticle(tbArticle);
    }


    /***
     * @description selectEsVo
     * @params []
     * @return com.shenmazong.utils.ResultResponse
     * @author -还怕大雨吗
     * @date 2021/9/25 11:28
     */
    @PostMapping("/selectEsVo")
    public ResultResponse selectEsVo(@RequestBody ListParamVo listParamVo){
        return tbArticleService.selectESTbo(listParamVo);
    }





}

